<template>
      <a-spin :spinning="loading">
  <a-list>
    <a-list-item v-for="(item, index) in list" :key="index">
      <router-link  class="no-focus" :to="{ 
        name: 'informList'
       }">
        <a-list-item-meta :title="item.title" :description="item.sendTime | moment('YYYY-MM-DD HH:mm:ss')">
        </a-list-item-meta>
        <div>{{item.sender}}</div>
      </router-link>
    </a-list-item> 
    <div
      v-if="list.length > 5"
      slot="loadMore"
      :style="{ textAlign: 'center', marginTop: '12px', height: '32px', lineHeight: '32px' }"
    >
      <router-link :to="{ 
        name: 'informList'
       }">
        查看更多
      </router-link>
    </div>
  </a-list>
  </a-spin>
</template>

<script>
import { getNotRead } from '@/api/notify'
export default {
  name: 'Notify',
  data () {
    return {
      loading: false,
      total: 0,
      list: []
    }
  },
  created() {
    
  },
  methods: {
    async getList() {
      this.list = []
      this.total = 0
      // const params = {
      //   pageNo: 1,
      //   pageSize: 5
      // }
      this.loading = true
      const res = await getNotRead()
      this.loading = false
      if (res.data) {
        this.total = res.data.length
        this.list = res.data.filter((item, index) => index < 5)
      }
    }
  }
}
</script>
<style lang="less" scoped>

</style>
